#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fu first
#define sx second
#define pl pair<ll,ll>
#define vl vector<ll>
#define vpl vector<pl>
#define mll map<ll,ll>
#define pb push_back
#define mpr make_pair
#define in1(a) \
ll a; \
cin >> a;
#define in2(a, b) \
ll a, b; \
cin >> a >> b
#define in3(a, b, c) \
ll a, b, c; \
cin >> a >> b >> c
#define in4(a, b, c, d) \
ll a, b, c, d; \
cin >> a >> b >> c >> d
#define outv(v) \
for (auto i : v) \
cout << i << " "; \
cout << endl;
#define outp(v) \
for (auto i : v) \
cout << i.fi << " " << i.se; \
cout << endl;
#define ld long long double
#define AMATERASU return 0;
#define out(x) cout << x << endl;
#define all(v) v.begin(), v.end()
#define nahi cout << "NO" << endl;
#define oyeah cout << "YES" << endl;
#define qll queue<long long>
#define pqll priority_queue<long long>
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define rfr(i,a,b) for(ll i=a;i>=b;i--)
#define vsort(V) sort(V.begin(),V.end())
#define rsort(V) sort(V.begin(),V.end(),greater<ll>())
#define MAX(V) *max_element(V.begin(),V.end())
#define MIN(V) *min_element(V.begin(),V.end())
#define rbd int test; cin >> test; while(test--)
#define ReZero {ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
#define vin(vec,n,type) for(ll i=0;i<n;i++){type p;cin >> p;vec.push_back(p);}
#define pin(vec,n,type1,type2) for(ll i=0;i<n;i++){type1 p; type2 q;cin >> p>>q;vec.push_back(make_pair(p,q));}
#define ain(a,n) for(ll i=0;i<n;i++){cin>>a[i];}
#define every(m) for(auto p:m)
#define fine(x,V) find(V.begin(),V.end(),x);
bool pot(ll n){
ll c=0;
while(n>0){
if((n&1)==1){
c++;
}
n=n>>1;
}
if(c==1) return true;
else return false;
}
signed main(){
ReZero;
rbd{
ll n;
cin>>n;
vl v;
vin(v,n,ll);
ll c=0,a=1;
while(a<n){
a=a*2;
}
a=a/2;
// cout<<a<<endl;
ll i=2,f=0;
while(i<n){
if(pot(i)){
i++;
continue;
}
else{
if(v[i]<v[i-1]){
f=1;break;
}
}
i++;
}
// cout<<endl;
if(f) nahi
else oyeah
}
AMATERASU
}
1237A - Balanced Rating Changes | 1616A - Integer Diversity |
1627B - Not Sitting | 1663C - Pōja Verdon |
1497A - Meximization | 1633B - Minority |
688B - Lovely Palindromes | 66B - Petya and Countryside |
1557B - Moamen and k-subarrays | 540A - Combination Lock |
1553C - Penalty | 1474E - What Is It |
1335B - Construct the String | 1004B - Sonya and Exhibition |
1397A - Juggling Letters | 985C - Liebig's Barrels |
115A - Party | 746B - Decoding |
1424G - Years | 1663A - Who Tested |
1073B - Vasya and Books | 195B - After Training |
455A - Boredom | 1099A - Snowball |
1651D - Nearest Excluded Points | 599A - Patrick and Shopping |
237A - Free Cash | 1615B - And It's Non-Zero |
1619E - MEX and Increments | 34B - Sale |